<%@page import="databank.DataBankVo"%>
<%@page import="databank.DataBank"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script>
function init(){
	
}

function btn_list(){
	location.href="index2.jsp?inc_center=./databank/list.jsp";
}

function fileDel(serial, filename){
	var f = confirm("정말 삭제하시겠습니까?");
	if(f){
		location.href="index2.jsp?inc_center=./databank/fileDel.jsp&serial="+serial+"&filename="+filename;
	}else{
		out.print("취소했습니다.");
	}
}
</script>
</head>
<body>
<jsp:useBean id="bankVo" class="databank.DataBankVo"/>
<jsp:setProperty property="*" name="bankVo"/>
<%
DataBank bank = new DataBank();
bank.setVo(bankVo);
DataBankVo vo = bank.view();
%>


	<form name="up_frm" action="index2.jsp?inc_center=./databank/modify_result.jsp" method="post" enctype="multipart/form-data">
			<div id="upload_title">글 수정하기</div><br/>
			
			올린사람 : <input type="text" name="mid" value="<%=vo.getMid()%>"><br/>
			제&emsp;&emsp;목 : <input type="text" name="subject" value="<%=vo.getSubject()%>"><br/>
			암&emsp;&emsp;호 : <input type="text" name="pwd" value="<%=vo.getPwd()%>"><br/>
			내&emsp;&emsp;용 : <br/>
			<textarea rows="3" cols="30" name="content"><%=vo.getContent()%></textarea><br/>
			
			파&ensp;일&ensp;명 :
			 
			<%if(vo.getFilename() == null || vo.getFilename().equals("")){%>
				<input type="file" name="newfilename">
			<%} else { %>
				<%=vo.getFilename()%>
				<input type='button' value='삭제' onclick="fileDel(<%=vo.getSerial()%>, '<%=vo.getFilename()%>')">
			<%} %>
			<br/>
			<input type="hidden" name="serial" value="<%=vo.getSerial()%>" >
			
			<input type="submit" value="수정">
			<input type="button" value="삭제">
			<input type="button" value="목록" id="upload_button" onclick="btn_list()">
			
		</form>
		
<script>
init();
</script>
</body>
</html>